-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify doc: Node.get_child
returns null for invalid index
#86349
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dalexeev
reviewed
Dec 20, 2023
dalexeev
added
enhancement
documentation
cherrypick:4.1
Considered for cherry-picking into a future 4.1.x release
cherrypick:4.2
Considered for cherry-picking into a future 4.2.x release
labels
Dec 20, 2023
You're right! Updated. |
Please squash commits into one. To do this you need a local git client, GitHub web interface doesn't support it. |
Squashed. |
dalexeev
approved these changes
Dec 20, 2023
YuriSizov
reviewed
Dec 22, 2023
akien-mga
changed the title
Clarify doc: Node.get_child returns null for invalid index
Clarify doc: Jan 3, 2024
Node.get_child
returns null for invalid index
It's still good to have, yeah, even with the new example code. It would need to be reworded slighly to match the new sentence. |
akien-mga
removed
the
cherrypick:4.1
Considered for cherry-picking into a future 4.1.x release
label
Jan 4, 2024
Rebased and reworded "error is logged" to "error is generated". Any other changes? |
I like it, myself! |
Thanks! |
YuriSizov
removed
the
cherrypick:4.2
Considered for cherry-picking into a future 4.2.x release
label
Jan 25, 2024
Cherry-picked for 4.2.2. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a line to
Node.get_child
's doc explaining that if no child exists at the specified index,null
will be returned.I found myself repeatedly writing code that checks for
get_child_count() >= (n + 1)
before callingget_child(n)
. I had a wrong assumption that callingget_child
with an out-of-bounds index would raise an error rather than returning null, as many collections do in other languages/frameworks. I think this would be helpful and relevant to mention in the doc.